﻿import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import YourComponents 1.0

Window {
    width: 800
    height: 600
    visible: true

    Column {
        anchors.fill: parent

        VideoItem {
            id: videoDisplay
            width: parent.width
            height: parent.height - 50

            Connections {
                target: frameProvider
                function onNewFrameAvailable(frame) {
                    videoDisplay.frame = frame
                }
            }

            onFrameProcessed: {
                frameProvider.frameProcessed()
            }
        }

        /*
        ProgressBar {
            width: parent.width
            from: 0
            to: frameProvider.duration
            value: frameProvider.position
        }
        */

        Row {
            Button {
                text: "Play"
                onClicked: frameProvider.startVideo("E:/abc-120.mp4")
            }
            Button {
                text: "Stop"
                onClicked: frameProvider.stopVideo()
            }
        }
    }
}
